<?php
/**
 * Created by PhpStorm.
 * User: u
 * Date: 2019/4/9
 * Time: 19:56
 */

namespace common\sources\write\pepperrecord;

use Yii;

class PepperRecordAccess implements IPepperRecordAccess
{
    public function addPepperRecord($param)
    {
        return Yii::$app->db->createCommand()->insert('buy_pepper_record', [
            'buy_id' =>  $param['buy_id'],
            'task_id' => isset($param['task_id']) ? $param['task_id'] : '',
            'task_commod_id' => isset($param['task_commod_id']) ? $param['task_commod_id'] : 0,
            'task_order_num' => isset($param['task_order_num'])? $param['task_order_num'] : '' ,
            'task_order_id' => isset($param['task_order_id']) ? $param['task_order_id'] : 0,
            "type" => $param['type'],
            'expend' => $param['expend'],
            'income' => $param['income'],
            'balance' => $param['balance'],
            'operatorId' => isset($param['operatorId']) ? $param['operatorId'] : 0 ,
            'remark' => $param['remark'],
            'freeze_change' => isset($param['freeze_change']) ? $param['freeze_change'] : 0.00,
            'freeze_balance' => isset($param['freeze_balance']) ? $param['freeze_balance'] : 0.00,
            'create_time' => time()
        ])->execute();
    }
}